import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralFlowProcessRecord = (params) => {
  params.head.transCode = 'queryGeneralFlowProcessRecord';
  return request({
    url: '/general/generalFlowProcessRecord/queryGeneralFlowProcessRecord',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralFlowProcessRecordListPage = (params) => {
  params.head.transCode = 'queryGeneralFlowProcessRecordListPage';
  return request({
    url: '/general/generalFlowProcessRecord/queryGeneralFlowProcessRecordListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralFlowProcessRecord = (params) => {
  params.head.transCode = 'saveGeneralFlowProcessRecord';
  return request({
    url: '/general/generalFlowProcessRecord/saveGeneralFlowProcessRecord',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralFlowProcessRecordList = (params) => {
  params.head.transCode = 'saveGeneralFlowProcessRecordList';
  return request({
    url: '/general/generalFlowProcessRecord/saveGeneralFlowProcessRecordList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralFlowProcessRecord = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralFlowProcessRecord';
  return request({
    url: '/general/generalFlowProcessRecord/saveOrUpdateGeneralFlowProcessRecord',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralFlowProcessRecordList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralFlowProcessRecordList';
  return request({
    url: '/general/generalFlowProcessRecord/saveOrUpdateGeneralFlowProcessRecordList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralFlowProcessRecord = (params) => {
  params.head.transCode = 'updateGeneralFlowProcessRecord';
  return request({
    url: '/general/generalFlowProcessRecord/updateGeneralFlowProcessRecord',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralFlowProcessRecord = (params) => {
  params.head.transCode = 'deleteGeneralFlowProcessRecord';
  return request({
    url: '/general/generalFlowProcessRecord/deleteGeneralFlowProcessRecord',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralFlowProcessRecordList = (params) => {
  params.head.transCode = 'deleteGeneralFlowProcessRecordList';
  return request({
    url: '/general/generalFlowProcessRecord/deleteGeneralFlowProcessRecordList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralFlowProcessRecordExcel = (params) => {
  downloadExcel({
    url: '/general/generalFlowProcessRecord/excelDownload/exportGeneralFlowProcessRecordExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}

//获取流程实例实时处理数据用于展示流程图
export const getProcessFlowChartData = (params) => {
  params.head.transCode = 'getProcessFlowChartData';
  return request({
    url: '/general/generalFlowProcessRecord/getProcessFlowChartData',
    method: 'post',
    data: params
  })
}

//获取流程实例的处理时间线
export const getProcessFlowTimelineData = (params) => {
  params.head.transCode = 'getProcessFlowTimelineData';
  return request({
    url: '/general/generalFlowProcessRecord/getProcessFlowTimelineData',
    method: 'post',
    data: params
  })
}